package com.rem.cloudalibaba.service.impl;

import com.rem.cloudalibaba.entity.Order;
import com.rem.cloudalibaba.entity.Product;
import com.rem.cloudalibaba.mapper.OrderMapper;
import com.rem.cloudalibaba.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Rem
 * @date 2021/7/13
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    OrderMapper orderMapper;

    /**
     * 根据商品创建订单
     *
     * @param product
     */
    @Override
    public void createOrder(Product product) {

        Order order = new Order();
        order.setPid(product.getPid()).setPname(product.getPname()).setPprice(product.getPprice()).setNumber(1);
        orderMapper.insert(order);
    }


}
